Method and design for dynamic management of descriptors for sgl operation

ABSTRACT

In an example, a method of managing direct memory access (DMA) descriptors for commands to a non-volatile semiconductor storage device includes requesting DMA descriptors from the host system for each of a plurality of the commands stored in a command random access memory (RAM). The method further includes storing the DMA descriptors for each of the plurality of the commands in free descriptor regions in a descriptor RAM. The method further includes maintaining a dynamic descriptor list in the descriptor RAM for each of the plurality of commands, the dynamic descriptor list for each of the plurality of commands comprising occupied descriptor regions in the descriptor RAM having associated DMA descriptors.

BACKGROUND

Solid-state drives (SSDs) generally have faster performance, are morecompact, and are less sensitive to vibration or physical shock thanconventional magnetic disk drives. Given these advantages, SSDs arebeing used in more and more computing devices and other consumerproducts in lieu of or in addition to magnetic disk drives, even thoughthe cost-per-gigabyte storage capacity of SSDs is significantly higherthan that of magnetic disk drives.

The performance of SSDs is not attributable only to the speed of readingfrom and writing to memory cells of SSDs, but also the time taken by theSSD controller to process the read and write commands issued byconnected host systems. From the perspective of the host system, IO(input-output operation) latency is measured by the time it issues theread or write command to the SSD to the time the SSD responds with readdata or a write acknowledgement. If there any delays between those twotime periods, including delays attributable to the SSD controller, thehost system will experience an increase in latency.

SSD controllers transfer read data and write data to and from the hostsystem using direct memory access (DMA) transfers. DMA is a techniquefor transferring blocks of data between system memory and peripheralswithout involving the system processor in each transfer. To avoidsetting aside large blocks of memory in the host system, an SSDcontroller can use a scatter-gather list (SGL) based DMA to transferread and write data. SGL-based DMA provides data transfers to and fromnon-contiguous blocks of system memory using a series ofcontiguous-block transfers. To effectuate DMA transfers, the host systemgenerates DMA descriptors that hold the necessary control information.In SGL based DMA, the number of descriptors needed for a given commandto the SSD is unknown. Accordingly, the SSD controller must adequatelymanage fetching and storing of DMA descriptors to conserve resources,while achieving desired performance and command latency.

SUMMARY

One or embodiments relate to a method of managing direct memory access(DMA) descriptors for commands to a non-volatile semiconductor storagedevice. The method includes requesting DMA descriptors from the hostsystem for each of a plurality of the commands stored in a commandrandom access memory (RAM). The method further includes storing the DMAdescriptors for each of the plurality of the commands in free descriptorregions in a descriptor RAM. The method further includes maintaining adynamic descriptor list in the descriptor RAM for each of the pluralityof commands, the dynamic descriptor list for each of the plurality ofcommands comprising occupied descriptor regions in the descriptor RAMhaving associated DMA descriptors.

One or more embodiments relate to a controller for a non-volatilesemiconductor storage device. The controller includes a command randomaccess memory (RAM) configured to store commands received from a hostsystem, a descriptor RAM, and a processing system having a back endconfigured to process active commands. The processing system furtherincludes a front end configured to fetch DMA descriptors from the hostsystem for each of a plurality of the commands stored in the commandRAM. The front end is further configured to store the DMA descriptorsfor each of the plurality of the commands in free descriptor regions inthe descriptor RAM. The front end is further configured to maintain adynamic descriptor list in the descriptor RAM for each of the pluralityof commands, the dynamic descriptor list for each of the plurality ofcommands comprising occupied descriptor regions in the descriptor RAMhaving associated DMA descriptors.

One or more embodiments relate to relate to a non-transitory computerreadable medium having instructions thereon that when executed by aprocessor cause the processor to perform the method recited above.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing an example of a computing systemincluding a storage device in communication with a host system.

FIG. 2 is a block diagram showing an example front end in more detail.

FIG. 3 is a block diagram illustrating the structure of command anddescriptor fields according to an embodiment.

FIG. 4 is a block diagram illustrating an example of DMA descriptorfetching and control flow in the front end of FIG. 2.

FIG. 5 is a block diagram illustrating an example of DMA descriptormanagement and control flow in the front end of FIG. 2.

FIG. 6 is a flow diagram depicting a method of fetching DMA descriptorsfor commands to a non-volatile storage device according to anembodiment.

FIG. 7 is a flow diagram depicting a method of managing DMA descriptorsfor commands to a non-volatile storage device according to anembodiment.

To facilitate understanding, identical reference numerals have beenused, where possible, to designate identical elements that are common tothe figures. It is contemplated that elements disclosed in oneembodiment may be beneficially utilized on other embodiments withoutspecific recitation.

DETAILED DESCRIPTION

Techniques for dynamic management of direct memory access (DMA)descriptors in a non-volatile memory storage device are described. Thetechniques described herein can be used to manage DMA descriptorscontained in scatter-gather lists (SGL) for SGL-based DMA operation. InSGL operation, the number of descriptors for a given command is unknownand there can be hundreds of active commands requiring DMA descriptors.Static allocation of buffer capacitive to store DMA descriptors foractive commands can lead to performance degradation, increased siliconarea, buffer inefficiency, and descriptor starvation. The techniquesdescribed herein employ dynamic allocation of buffer capacity to storeDMA descriptors for commands. Data and metadata DMA descriptors arehandled with the same engine, and in the same buffer area with noincrease in overhead.

FIG. 1 is a block diagram showing an example of a computing system 100including a storage device 104 in communication with a host system 102.Host system 102 is a computing system that comprises one or more centralprocessor units (CPUs) 150, a system memory 152, a peripheral bus 154,and other components as is generally known. CPUs 150 can include anytype of microprocessor(s) known in the art. System memory 152 mayinclude, for example, random access memory (RAM), read only memory(ROM), or a combination thereof. Peripheral bus 154 can be any type ofcomputer bus interface, such as a peripheral component interconnectexpress (PCIe) bus, serial advanced technology attachment (SATA) bus, orthe like. Storage device 104 provides non-volatile storage functionalityfor use by host system 102. Storage device 104 can be a solid-statedrive (“SSD”), which is a non-volatile storage device that includesnon-volatile semiconductor-based storage elements, such as NAND-basedflash memory, as the storage medium (as opposed to, for example, themagnetic medium used in hard disk drives).

Storage device 104 includes an SSD controller 105, volatile memory 114,and non-volatile semiconductor memory 112. Storage device 104 may alsoinclude other elements not shown, such as power supply circuitry(including circuitry for transferring power to the SSD controller 105,volatile memory 114, and non-volatile semiconductor memory 112, as wellas capacitors for buffering the power supply), indicator lightcircuitry, temperature sensors, boot circuitry, clock circuitry, andother circuitry for assisting with various functions.

SSD controller 105 receives and processes commands from host system 102in order to perform operations on the non-volatile semiconductor memory112. Commands from host system 102 include requests to read or write tolocations within the non-volatile semiconductor memory 112, and variousadministrative commands, such as commands for querying the feature setof storage device 104, commands for formatting non-volatile memory 112,commands for creating and modifying various types of queues, commandsfor requesting notification of various events, and various othercommands. SSD controller 105 includes a host interface 106, a front end108, a back end 110, a command bus 118, and a data bus 116.

Host interface 106 comprises circuitry for communicating with hostsystem 102. In one embodiment, host interface 106 is coupled toperipheral bus 154 in host system 102 through one or more ports (e.g.,two ports are shown). For example, host interface 106 can be a PCIeinterface that communicates according to the PCIe standard, and SSDcontroller 105 can comply with the non-volatile memory host controllerinterface specification (NVMHCI) referred to as “NVM express” or “NVMe.”In another embodiment, the interface is a SATA interface.

Front end 108 communicates with host system 102 to fetch, organize, andforward commands from host system 102 to back end 110. Host system 102can maintain host command queues 160, such as one or more submissionqueues and one or more completion queues. Front en 108 can fetchcommands from submission queues in host system 102. Front end 108 alsoforwards status data from back end 110 to host system 102, such ascommand completion data. Front end 108 can provide command completiondata to completion queues in host system 102.

Back end 110 performs tasks associated with commands received from frontend 108, accessing non-volatile semiconductor memory 112 as needed inaccordance with these tasks. Back end 110 employs direct memory access(DMA) to store and retrieve data from system memory 152 of host system102. For example, back end 110 can transfer data that has been read fromnon-volatile semiconductor memory 112 to system memory 152 using DMA(“read data 164”). Back end 110 can transfer data to be written tonon-volatile semiconductor memory 112 from system memory 152 using DMA(“write data 162”). In an embodiment, read data 164 and write data 162are stored in non-contiguous areas of system memory 152, and back end110 employs SGL-based DMA to write read data 164 to system memory 152,and retrieve write data 162 from system memory 152.

Both front end 108 and back end 110 are coupled to a command bus 118 anda data bus 116. Command bus 118 functions to transfer command-relateddata between various sub-units of front end 108 and back end 110, anddata bus 116 serves to transfer data between volatile memory 114 andvarious sub-units of front end 108 and back end 110. Volatile memory 114can include one or more types of RAM, such as static RAM (SRAM), dynamicRAM (DRAM), or the like.

Volatile memory 114 can include RAM modules or specific regions of RAMdedicated to storing particular types of data. In an embodiment,volatile memory 114 includes command RAM 138 configured to storecommands received from host system 102, descriptor RAM 140 configured tostore DMA descriptors (also referred to herein as “descriptors”)received from host system 102. Data buffer RAM 126 configures a readcache and a write cache. A read cache temporarily stores data read fromnon-volatile semiconductor memory 112 (“read data”) in response to acommand from host system 102. A write cache temporarily stores data tobe written to non-volatile semiconductor memory 112 (“write data”) inresponse to a command from host system 102.

While command RAM 138, descriptor RAM 140, and data buffer RAM 126 areshown as being part of a single group of volatile memory coupled to databus 116, other configurations are possible. For example, command RAM 138and descriptor RAM 140 can be part of a group of volatile memory onlycoupled to front end 108, and data buffer RAM 126 can be part of a groupof volatile memory only coupled to back end 110. In such an example,front end 108 can forward command and descriptor data to back end 110over a bus (e.g., command bus 118 or data bus 116) or by a direct linkto back end 110, rather than back end 110 having direct access tocommand and descriptor data in volatile memory 114.

Non-volatile semiconductor memory 112 stores data in a non-volatilemanner at the request of host system 102. Non-volatile semiconductormemory 112 includes one or more arrays of non-volatilesemiconductor-based storage elements, some examples of which includenon-volatile NAND flash memory, non-volatile NOR flash memory,non-volatile DRAM based memory, magnetoresistive random-access memory(MRAM), and other types of memory. As NAND-based flash memory iscommonly used as the non-volatile semiconductor memory 112, non-volatilesemiconductor memory 112 may be referred to herein as NAND memory 112 orsimply as NAND 112.

Front end 108 includes multiple functional units, including queuingcontrol unit 119, command processing unit 120, descriptor processingunit 121, host signaling unit 122, and data transfer unit 124. Commandprocessing unit 120 fetches commands from host system 102. Commandprocessing unit 120 provides the commands to queuing control unit 119.Queuing control unit 119 stores the commands in command RAM 138. Queuingcontrol unit 119 implements command load balancing to select eligiblecommands to be performed by back end 110. Command processing unit 120forwards commands selected by queuing control unit 119 to back end 110for processing. Command processing unit 120 can also perform variousoperations on commands, such as command checks. Command processing unit120 also receives status information for the commands from back end 110.Descriptor processing unit 121 fetches DMA descriptors 166 from systemmemory 152 associated with the commands. DMA descriptors 166 point toaddresses in system memory 152 for write data 162 and read data 164. Inan embodiment, DMA descriptors 166 are organized into scatter-gatherlist (SGL) segments for SGL-based DMA transfer. Descriptor processingunit 121 stores fetched descriptors for the commands in descriptor RAM140.

Host signaling unit 122 can transmit command status information obtainedfrom command processing unit 120 to host system 102. Host signaling unit122 generates host notification signals and transmits these signals tohost system 102. These signals may be used to indicate that one or morecommands fetched from host system 102 are complete. Host notificationsignals include interrupts and may be out-of-band, pin-based interrupts,or may be in-band message signaled interrupts (“MSI” or “MSIx”). Theinterrupts include data identifying the command that has been completedas well as status data associated with that command. Host signaling unit122 includes an interrupt table that includes such information, as wellas an interrupt generator which generates interrupts for transmission tohost system 102, based on the information stored in the interrupt table.

Data transfer unit 124 serves as an intermediary between host interface106 and the sub-units of front end 108 (e.g., queue control unit 119,command processing unit 120, and descriptor processing unit 121). Datatransfer unit 124 directs data received from host interface 106 to theappropriate sub-unit (e.g., command data to command processing unit 120and descriptor data to descriptor processing unit 121).

Back end 110 includes multiple functional units, including a commandqueue 128, an error correction unit 130, a logical-to-physical addresstranslation unit 132, a NAND management unit 134, and DMA managementunit 136. Command queue 128 stores commands received from front end 108for further processing. Buffering commands in this manner allows backend 110 to process received commands based on a particular schedule oron specific timing or state-based constraints. Error correction unit 130provides error correction functionality for data stored in non-volatilesemiconductor memory 112. Error correction unit 130 generateserror-correction data for data written to the non-volatile semiconductormemory 112 and stores the error-correction data with the written data.When the written data is read out and error in reading is encountered,error correction unit 130 performs error correction operations using theerror-correction data.

Logical-to-physical translation unit 132 translates logical addresses,e.g., logical block addresses (LBAs), to physical addresses, e.g.,physical block addresses, of non-volatile semiconductor memory 112during reading or writing data. Logical-to-physical translation unit 132accesses a map, known as a flash translation layer (FTL), whenconverting logical addresses to physical addresses so that datarequested by host system 102 with a logical address can be properlyphysically addressed within non-volatile semiconductor memory 112.

NAND management unit 134 is configured to write data to non-volatilesemiconductor memory 112 and read data from non-volatile semiconductormemory 112. NAND management unit 134 stores data read from non-volatilesemiconductor memory 112 in a read cache in data buffer RAM 126. NANDmanagement unit 134 receives data to be written to non-volatilesemiconductor memory 112 from a write cache in data buffer RAM 126. NANDmanagement unit 134 may also provide other functions, such as wearleveling, bad block mapping, garbage collection, and read scrubbing.

Wear leveling is a technique to compensate for the fact that a(relatively) limited number of write operations can be performed on eachNAND data storage element, commonly referred to as a block. Wearleveling comprises periodically moving data between NAND data storageblocks in order to even out or “level” the number of times writeoperations are performed for each data storage block. Bad block mappingis a technique for marking blocks as being “bad” after it is discoveredthat such blocks are unreliable. Blocks marked as bad are not written toor read from.

Garbage collection is a technique whereby valid pages (a subunit of ablock) within a block are copied to a new block so that the source blockcan be erased. Garbage collection is needed in NAND memory because theunit of writing is a page and the unit of erasure is a block.Accordingly, if a command to write data targets an existing page, thenthe data of the existing page is not actually modified. Instead, a newpage is written and the old page is marked as invalid. As a result, thenumber of invalid pages continue to grow and garbage collection becomesnecessary to free up blocks having a large number of invalid pages.

Read scrubbing is a technique whereby SSD controller 105 periodicallyreads data in the non-volatile semiconductor memory 112, performs errorchecking operations on the data to determine if there are errors,corrects errors that are found, and then writes the error-corrected databack to the same location. This technique helps to reduce the amount oferrors experienced when reading data out from the non-volatilesemiconductor memory 112.

DMA management unit 136 is configured to control DMA transfer of databetween SSD controller 105 and system memory 152 in host system 102. DMAmanagement unit 136 uses DMA descriptors fetched by front end 108, whichpoint to read and write buffers in system memory 152. DMA managementunit 136 transfers data from a read cache in data buffer RAM 126 tosystem memory 152 using corresponding DMA descriptors associated with acorresponding read command. DMA management unit 136 transfers data towrite cache in data buffer RAM 126 from system memory 152 usingcorresponding DMA descriptors associated with a corresponding writecommand.

In various embodiments, the functional blocks included in front end 108and back end 110 represent hardware or combined software and hardwareelements for performing associated functionality. Thus, any or all ofthe functional blocks may be embodied as firmware executing in aprocessing unit, as hardware units that are hard-wired to perform theassociated functionality, or as a combination thereof. For example,either or both of front end 108 or back end 110 may include one or moreprocessors, one or more state machines, one or more application specificintegrated circuits (ASICs), one or more programmable integratedcircuits, or the like, that are programmed or configured to performfunctions related to the functional blocks. Alternatively, a singleprocessor may be shared between and thus may perform the functions ofboth front end 108 and back end 110.

Certain functional blocks and functionality associated therewith thatare depicted as being included within front end 108 or back end 110 maybe implemented as data structures stored within volatile memory 114.Thus, for example, queues indicated as being included in front end 108and back end 110, may be stored within volatile memory 114. Whilespecific functional units are shown in front end 108 and back end 110,other configurations of functional units can be used to implement thefunctionality described herein. In general, front end 108 and back end110 can include one or more functional units that perform thefunctionality described herein.

In various examples described herein, front end 108 and functionsthereof are described as being part of SSD controller 105 in storagedevice 104. In another embodiment, front end 108 can be separate fromSSD controller 105 and/or separate from storage device 104. For example,front end 108 can be part of a controller external to storage device104. In another embodiment, front end 108 can be implemented by hostsystem 102. For example, the functions performed by front end 108described above can be implemented in software executed by CPUs 150 inhost system 102. Command RAM 138 and descriptor RAM 140 can be part ofsystem memory 152. In such an embodiment, front end 108 is omitted fromSSD controller 105 in storage device 104. In still another embodiment,functions of front end 108 can be divided between host system 102 andcontroller 105 in storage device 104.

FIG. 2 is a block diagram showing an example front end 108 in moredetail. FIG. 2 shows more detail for the functions of queuing controlunit 119, command processing 120, and descriptor processing 121. Frontend 108 includes a control unit 251 coupled to a command RAM controller216 and a descriptor RAM controller 254. Control unit 251 is alsocoupled to back end 110. Control unit 251 includes a command controlunit 250 and a descriptor control unit 252. Command RAM controller 216is coupled to command RAM 138. Descriptor RAM controller 254 is coupledto descriptor RAM 140.

Back end 110 includes a read transfer controller 280, a write transfercontroller 282, a fetch controller 284, a read controller 286, and awrite controller 288. Read transfer controller 280 is configured toperform DMA transfer of read data to host system 102 using DMAdescriptors stored in descriptor RAM 140. Write transfer controller 282is configured to perform DMA transfer of write data from host system 102using DMA descriptors stored in descriptor RAM 140. In an embodiment,each read operation is a two-phase operation of fetching data fromnon-volatile semiconductor memory 112 and transferring data fromnon-volatile semiconductor memory 112. Fetch controller 284 isconfigured to fetch data from non-volatile semiconductor memory 112 inresponse to a read command. Read controller 286 is configured totransfer data from non-volatile semiconductor memory 112 in response toa read command. Write controller 288 is configured to write data tonon-volatile semiconductor memory 112 in response to a write command.

Command control unit 250 is configured to fetch commands from hostsystem 102 (e.g., through data transfer unit 124) and to pass thecommands to command RAM controller 216. Alternatively, command controlunit 250 can fetch commands from host system 102, and command RAMcontroller 216 can receive the commands from host system 102 (e.g.,through data transfer unit 124). Command control unit 250 can performone or more operations on the commands, such as various command checkoperations. Command control unit 250 is further configured to obtainactive commands from command RAM controller 216 and issue activecommands to back end 110 for processing. Command control unit 250 isfurther configured to obtain command status from back end 110.

Command RAM controller 216 is configured to receive commands fromcommand control unit 250 or from data transfer unit 124. Command RAMcontroller 216 is further configured to store the commands in commandRAM 138. Command RAM controller 216 is further configured to manage aplurality of queues of commands (“command queues 231”). Command RAMcontroller 216 is further configured to enqueue or “push” commands intospecific command queues, and dequeue or “pop” commands from specificcommand queues. Command RAM controller 216 is further configured toarbitrate selection among the command queues. In an example, command RAMcontroller 216 performs such functions using an access arbiter unit 218,a RAM access manager unit 220, a queue push controller unit 222, a queuepop controller unit 224, and a queue manager unit 226.

Descriptor control unit 252 is configured to fetch DMA descriptors fromhost system 102. The fetched DMA descriptors can include both datadescriptors and metadata descriptors. Data descriptors point to read andwrite buffers in host system 102. Metadata descriptors point to read andwrite metadata buffers in host system 102, each of which can storevarious information associated with the read/write data (e.g., paritydata for cyclic redundancy check (CRC)). Descriptor control unit 252 isconfigured to receive DMA descriptors from host system 102 (e.g.,through data transfer unit 124) and to pass the DMA descriptors todescriptor RAM controller 254. Alternatively, descriptor control unit252 can fetch DMA descriptors from host system 102, and descriptor RAMcontroller 254 can receive the DMA descriptors from host system 102(e.g., through data transfer unit 124). Descriptor control unit 252 isconfigured to manage DMA descriptor fetching for commands according todynamic quotas, as described further below.

Descriptor RAM controller 254 is configured to receive descriptors fromdescriptor control unit 252 or from data transfer unit 124. DescriptorRAM controller 254 is further configured to store the descriptors indescriptor RAM 140. Descriptor RAM controller 254 is configured tobuffer the DMA descriptors and pack them into words in descriptor RAM140. Descriptor RAM controller 254 is configured to update commands inthe command RAM 138 to associate the commands with fetched DMAdescriptors stored in the descriptor RAM 140. Descriptor RAM controller254 is configured to establish dynamic descriptor lists for commands incommand RAM 138. In an example, descriptor RAM controller 254 performssuch functions using a buffer unit 256, a packer unit 258, a RAM accessmanager unit 260, and a command updater unit 262.

In operation, command control unit 250 fetches input commands andobtains a command ID for each input command from command RAM controller216. Queue manager 226 maintains various queues, including commandqueues 231 and a free command queue 230. Free command queue 230 storesfree (unused) command IDs that can be assigned to input commands.Command RAM 138 includes space to store a particular number of commands.In an embodiment, command RAM 138 can store N words 234-1 through 234-N(collectively referred to as “command words 234” or generally referredto as “a command word 234”). A command can be stored in a command word234. In an embodiment, a command word 234 comprises command fields 236for a command and a pointer 238. Command fields 236 include various dataassociated with a command, as described below. Pointer 238 can store anaddress in command RAM 138 to another command word 234, as describedbelow. In an embodiment, command RAM controller 216 supports N commandIDs, where each command ID comprises an address of a command word 234 incommand RAM 138.

Command queues 231 can include various queue hierarchies. Commandcontrol unit 150 and command RAM controller 216 can cooperate to queuecommands in command queues 231 for command load balancing. For example,command queues 231 can include queues based on command origination(e.g., port, function, host queue ID), command destination (e.g.,namespace), command type (e.g., read, write, large read, large write),or a combination thereof. Queue push controller 222 enqueues or “pushes”commands into command queues 231, and queue pop controller 224 dequeuesor “pops” commands from command queues 231. RAM access manager 220 isconfigured to write commands to, and read commands from, command RAM138. Access arbiter 218 is configured to select commands from commandqueues 231 for command processing, further queue assignment, and commandissuance to back end 110. Throughout operation, some commands in commandRAM 138 may be queued and waiting for back end processing (“queuedcommands”), while other commands may be active and issued for back endprocessing (“active commands”).

In an embodiment, command queues 231 can be implemented usinglinked-lists of commands. Thus, each of command queues 231 can bespecified by a head pointer and a tail pointer. Within a given commandqueue, pointer 238 is used to link one command word 234 to anothercommand word 234.

Descriptor control unit 252 manages fetching of descriptors for thecommands in command RAM 138, and descriptor RAM controller 254 managesstorage of descriptors in descriptor RAM 140 for the commands in commandRAM 138. In an embodiment, the descriptors comprise descriptors in anSGL. For SGL operation, the number of descriptors needed for a givencommand is unknown. Descriptor control unit 252 minimizes bufferrequirements and reduces command latencies by intelligently fetchingdescriptors from host system 102 for particular commands based ondynamic quotas. Operation of descriptor control unit 252 is describedbelow with respect to FIG. 4.

Descriptor RAM controller 254 dynamically allocates memory in descriptorRAM 140 to hold DMA descriptors for commands. In particular, descriptorRAM 140 includes space to store a particular number of descriptors.Descriptor RAM 140 is configured to store K words 239-1 through 239-K(collectively referred to as “descriptor words 239” or generallyreferred to as “descriptor word 239”). Each descriptor word 239 canstore one or more DMA descriptors for a command. In an embodiment, adescriptor word 239 comprises descriptor fields 240 for DMAdescriptor(s) and a pointer 242. Descriptor fields 240 include variousdata associated with DMA descriptor(s), as described below. Pointer 242can store an address in descriptor RAM 140 to another descriptor word239. In an embodiment, descriptor RAM 140 supports K descriptor wordIDs, where each descriptor word ID comprises an address of a descriptorword 239 in descriptor RAM 140. Descriptor RAM 140 can store a freedescriptor first-in-first-out (FIFO) 243 that stores free descriptorword IDs.

In an embodiment, pointer 242 for each descriptor word 239 is stored ina separate memory module or separate address space than the remainingportion of each descriptor word 239. That is, pointer 242 can beseparately addressable from the remaining portion of descriptor word239. In this manner, descriptor RAM controller 254 can update pointer242 without performing a read/modify/write operation for the respectivedescriptor word 239. Thus, descriptor words 239 can include a firstaddressable portion 246 comprising descriptor fields 240, and a secondaddressable portion 248 comprising pointers 242.

Commands in command RAM 138 can be associated with dynamic descriptorlists (also referred to as descriptor lists). In an embodiment,descriptor lists for commands can be implemented using linked-lists ofdescriptor words 239 in descriptor RAM 140. Thus, a descriptor list fora command can be specified by a head pointer and a tail pointer. In eachdescriptor list, pointer 242 is used to link one descriptor word 239 toanother descriptor word 239. Commands can be associated with both datadescriptor lists and metadata descriptor lists, as discussed in FIG. 3below.

Buffer unit 256 in descriptor RAM controller 254 stores descriptorsfetched by descriptor control unit 252 for specified command IDs.Command updater unit 262 accesses commands in command RAM 138 based onthe specified command IDs, and updates command fields 236 to associatefetched DMA descriptors with commands. In some embodiments, eachdescriptor word 239 can store a plurality of descriptors for a command.Packer unit 258 can ensure that partially filed descriptor words 239 fora given command are filled with newly fetched descriptors beforeobtaining a free descriptor word from free descriptor FIFO 243. RAMaccess manager 260 can write data to, and read data from, descriptor RAM140. In an embodiment, RAM access manager 260 can also write data to,and read data from, command RAM 138. Alternatively, command updater 262can communicate with command RAM controller 216 to obtain and updatecommands.

FIG. 3 is a block diagram illustrating the structure of command anddescriptor fields according to an embodiment. Command fields 236 in eachcommand word 234 comprise command data 302, data descriptor head pointer304, metadata descriptor head pointer 306, and descriptor tail pointer308. Command data 302 includes data associated with the given command,such as a command identifier, a DMA type field specifying the type ofDMA transfer, an opcode field specifying the type of operation, and anamespace identifier. In SGL operation, command data 302 includes datafor an SGL segment in an SGL segment list (“SGL segment data”). Ingeneral, an SGL segment includes an area in system memory 152 having oneor more DMA descriptors and a pointer to a next SGL segment. The SGLsegment data in command data 302 can include a pointer to an SGL segmentand a number of DMA descriptors to be read from the SGL segment. Commanddata 302 can include separate SGL segment data for data and metadata DMAdescriptors.

Data descriptor head pointer 304 is a pointer to a first descriptor word239 in descriptor RAM 140 having data descriptor(s) for the command.Metadata head pointer 306 is a pointer to a first descriptor word 239 indescriptor RAM 140 having metadata descriptor(s) for the command.Descriptor tail pointer 308 is a pointer to a last descriptor word 239in descriptor RAM 140 having descriptor data for the command. Together,the data descriptor head pointer 304, the metadata descriptor headpointer 306, and the descriptor tail pointer 308 define a data andmetadata descriptor lists for the command. Each descriptor list islinked using pointers 242 in descriptor words 239.

Descriptor fields 240 comprise flags 320 and descriptors 322-1 through322-4 (collectively descriptors 322). Although four descriptors 322 areshown in the example, descriptor fields 240 can store more or lessdescriptors. Descriptor fields 240 can store data or metadatadescriptors. A given DMA descriptor generally includes source anddestination buses and address information, the amount of data to betransferred, maximum burst size, addressing modes, bus sizes,transaction types, and the like known in the art. Flags 320 can be usedto identify which of descriptors 322 is a data descriptor or metadatadescriptor, which of descriptors 322 has been consumed, which ofdescriptors 322 is valid, and like type status information associatedwith descriptors 322.

FIG. 4 is a block diagram illustrating an example of DMA descriptorfetching and control flow in front end 108. As described above, inputcommands are stored in command RAM 138. In the example, command RAM 138stores queued write commands 402, active write commands 404, active readcommands 406, and queued read commands 408. Queued write commands 402include one or more write commands stored in command queues 231 of frontend 108 and waiting to be issued to back end 110 for processing. Activewrite commands 404 include one or more write commands that have beenissued to back end 110 for processing. Write transfer controller 282performs one or more DMA transfers to obtain write data from host system102 using DMA descriptors in descriptor RAM 140 for active writecommands 404. Write controller 288 stores write data in non-volatilesemiconductor memory 112.

Active read commands 406 include one or more read commands that havebeen issued to back end 110 for processing. Reading from non-volatilesemiconductor memory 112 typically takes longer to perform than writingto non-volatile semiconductor memory 112 and thus a read commandtypically invokes a two-phase read operation having a fetch phase and adata transfer phase. Thus, active read commands 406 include active readcommands for which data has yet to be fetched, and active read commandsfor which data has been fetched. Fetch controller 284 fetches read datafrom non-volatile semiconductor memory 112 for active read commands. Aread pre-fetch queue assignment unit 410 assigns read commands back tocommand queues 231 after fetch controller 284 has completed fetchoperations. As such, queued read commands 408 can include one or moreread commands stored in command queues 231 of front end 108 and waitingfor data transfer. Read transfer controller 280 performs one or more DMAtransfers to store read data to host system 102 using DMA descriptors indescriptor RAM 140 for active read commands 404. Read controller 286obtains the fetched read data from the non-volatile semiconductor memory112.

Descriptor control unit 252 includes a descriptor fetch unit 412 and aquota management unit 414. Descriptor fetch unit 412 selects commandsstored in command RAM 138 for which to obtain DMA descriptors accordingto criteria established by quota management unit 414. Descriptor fetchunit 412 initiates descriptor fetch operations for the selectedcommands. Descriptor fetch unit 412 can fetch DMA descriptors for data,metadata, or both. Descriptor fetch operations can be of two differenttypes: fetch operations for active commands (also referred to as“active-transfer fetch operations”) versus pre-fetch operations forqueued commands.

In an embodiment, quota management unit 414 maintains a real-time fetchquota and a pre-fetch quota. Descriptor control unit 252 fetches DMAdescriptors from host system 102 for the active commands according tothe real-time fetch quota. Descriptor control unit 252 pre-fetches DMAdescriptors from the host system for queued commands according to thepre-fetch quota. “Pre-fetching” is a type of DMA fetching operationwhere DMA descriptors are fetched for queued commands (commands that arenot yet active).

Quota management unit 414 can maintain other restrictions or quotas thatcan further restrict fetching and pre-fetching of DMA descriptors. Asdiscussed above, front end 108 can receive commands over a plurality ofports. In an embodiment, quota management unit 414 can further subjectfetching and pre-fetching operations to a maximum number of DMAdescriptor fetch operations per port of the plurality of ports. In anembodiment, quota management unit 414 can further subject fetching andpre-fetching operations to a maximum number of DMA descriptor fetchoperations per read command type and write command type. In anembodiment, front end 108 categorizes commands into a plurality oftransfer sizes (e.g., read commands and large read commands, writecommands and large write commands). Quota management unit 414 canfurther subject fetching and pre-fetching operations to a maximum numberof DMA fetch operations per transfer size of the commands.

In an embodiment, quota management unit 414 can adjust the real-timefetch quota dynamically over time. For example, the write transfercontroller 282 and the read transfer controller 280 can perform DMAtransfers of clusters of data. Quota management unit 414 can adjustreal-time fetch quota to maintain a descriptor capacity for a definednumber of cluster transfers as DMA transfers are performed by back end110. In an embodiment, active write commands have the highest priority.As such, in an embodiment, quota management unit 414 can communicatewith write transfer controller 282 and re-evaluate the real-time fetchquota after one or more clusters have been transferred for active writecommands.

In an embodiment, quota management unit 414 selects eligible commandqueues 231 from which to select commands for pre-fetching DMAdescriptors. Descriptor fetch unit 412 can select commands forpre-fetching DMA descriptors from eligible commands queues according toa specified schedule, such as a round-robin schedule. Since writeoperations are performed sequentially, quota management unit 414 can setthe pre-fetch quota to include a maximum number of DMA descriptorscorresponding to a maximum number of queued write commands in theeligible command queues (e.g., four DMA descriptors for five queuedwrite commands). Quota management unit 414 can keep track of activewrite commands and, after each write command completion, re-evaluatecommand queue eligibility. In an embodiment, read command queues arealways eligible.

Descriptor fetch unit 412 determines the number of DMA descriptors tofetch from host system 102 for each selected command. In an embodiment,the number of DMA descriptors to be fetched is the smaller of: thenumber of free descriptor entries in the descriptor RAM; the number ofDMA descriptors remaining in an SGL segment for the command; a number ofDMA descriptors satisfying another quota (e.g., port quota, read/writequota, transfer size quota); and a number of DMA descriptors satisfyinga respective one of the real-time fetch quota or the pre-fetch quota.

FIG. 5 is a block diagram illustrating an example of DMA descriptormanagement and control flow in front end 108. As described above, inputcommands are stored in command RAM 138. In the example, command RAM 138stores queued commands 502, active read commands 504, and active writecommands 506. Queued commands 502 include one or more commands stored incommand queues 231 of front end 108 and waiting to be issued to back end110 for processing. Active write commands 504 include one or more writecommands that have been issued to back end 110 for processing. Activeread commands 506 include one or more read commands that have beenissued to back end 110 for processing.

Descriptor control unit 252 selects commands in command RAM 138 forwhich to obtain DMA descriptors, as described above. Descriptor RAMcontroller 254 receives descriptor data comprising fetched DMAdescriptors for commands selected by descriptor control unit 252.Descriptor RAM controller 254 updates the commands in command RAM 138according to the received DMA descriptors. For example, descriptor RAMcontroller 254 updates SGL data in command data 302, updates datadescriptor head pointer 304, updates meta data descriptor head pointer306, updates descriptor tail pointer 308, or a combination thereof. Ifthe fetched DMA descriptors are the first DMA descriptors for a givencommand, descriptor RAM controller 254 obtains a new descriptor ID fromfree descriptor FIFO 243. Descriptor RAM controller 254 stores the DMAdescriptors in descriptor RAM 140 for the commands.

In the example shown, descriptor RAM 140 stores a list 508 of DMAdescriptor words 239 for a command in queued commands 502. A commandword 234 for the command has pointers defining list 508. Descriptor RAM140 stores a list 510 of DMA descriptor words 239 for a command inactive write commands 504. A command word 234 for the command haspointers defining list 510. Descriptor RAM 140 stores a list 512 of DMAdescriptor words 239 for a command in active read commands 406. Acommand word 234 for the command has pointers defining list 512.Descriptor RAM 140 also has a group 509 of free descriptor words. Readtransfer controller 280 and write transfer controller 282 can obtain oraccess descriptor lists in descriptor RAM 140 to perform DMA transferoperations for active commands.

FIG. 6 is a flow diagram depicting a method 600 of fetching DMAdescriptors for commands to a non-volatile storage device according toan embodiment. Method 600 can be performed by front end 108 of SSDcontroller 105 discussed above. Method 600 begins at operation 602,wherein front end 108 stores commands (e.g., read commands and writecommands) in command queues. At operation 604, front end 108 transfersactive commands from queues to back end 110 for processing. At operation606, front end 108 fetches DMA descriptors from host system 102 foractive commands according to a real-time fetch quota. At operation 608,front end 108 pre-fetches DMA descriptors from host system for queuedcommands according to a pre-fetch quota. At operation 610, front end 108stores fetched and pre-fetched DMA descriptors in descriptor RAM 140. Atoperation 612, front end 108 manages the real-time fetch quota and thepre-fetch quota during descriptor and command processing. For example,front end 108 can dynamically adjust real-time fetch quota as DMAtransfers are performed.

FIG. 7 is a flow diagram depicting a method 700 of managing DMAdescriptors for commands to a non-volatile storage device according toan embodiment. Method 700 can be performed by front end 108 of SSDcontroller 105 discussed above. Method 700 begins at operation 702,where front end 108 fetches DMA descriptors from host system 102 forcommands stored in command RAM 138. In an embodiment, operation 702 canperform method 600 of FIG. 6. At operation 704, front end 108 stores DMAdescriptors for commands in free descriptor words 239 in descriptor RAM140. Operation 704 can include an operation 706, where front end 108stores data and metadata descriptors together in descriptor RAM 140.

At operation 708, front end 108 maintains dynamic descriptor lists indescriptor RAM 140 for the commands. Operation 708 can include anoperation 710, where front end 108 updates data descriptor head,metadata descriptor head, and tail pointers in each command. Atoperation 712, front end 108 transfers descriptors for commands to backend 110. At operation 714, front end 108 marks and frees descriptorwords in descriptor RAM 140 as descriptors are consumed by back end 110.At operation 716, front end 108 frees any remaining descriptor words indescriptor RAM 140 for a command when the command is complete.

The various embodiments described herein may employ variouscomputer-implemented operations involving data stored in computersystems. For example, these operations may require physical manipulationof physical quantities—usually, though not necessarily, these quantitiesmay take the form of electrical or magnetic signals, where they orrepresentations of them are capable of being stored, transferred,combined, compared, or otherwise manipulated. Further, suchmanipulations are often referred to in terms, such as producing,identifying, determining, or comparing. Any operations described hereinthat form part of one or more embodiments of the invention may be usefulmachine operations. In addition, one or more embodiments of theinvention also relate to a device or an apparatus for performing theseoperations. The apparatus may be specially constructed for specificrequired purposes, or it may be a general purpose computer selectivelyactivated or configured by a computer program stored in the computer. Inparticular, various general purpose machines may be used with computerprograms written in accordance with the teachings herein, or it may bemore convenient to construct a more specialized apparatus to perform therequired operations.

The various embodiments described herein may be practiced with othercomputer system configurations including hand-held devices,microprocessor systems, microprocessor-based or programmable consumerelectronics, minicomputers, mainframe computers, and the like.

One or more embodiments of the present invention may be implemented asone or more computer programs or as one or more computer program modulesembodied in one or more computer readable media. The term computerreadable medium refers to any data storage device that can store datawhich can thereafter be input to a computer system—computer readablemedia may be based on any existing or subsequently developed technologyfor embodying computer programs in a manner that enables them to be readby a computer. Examples of a computer readable medium include a harddrive, network attached storage (NAS), read-only memory, random-accessmemory (e.g., a flash memory device), a CD (Compact Discs)—CD-ROM, aCD-R, or a CD-RW, a DVD (Digital Versatile Disc), a magnetic tape, andother optical and non-optical data storage devices. The computerreadable medium can also be distributed over a network coupled computersystem so that the computer readable code is stored and executed in adistributed fashion.

Boundaries between various components, operations and data stores aresomewhat arbitrary, and particular operations are illustrated in thecontext of specific illustrative configurations. Other allocations offunctionality are envisioned and may fall within the scope of theinvention(s). In general, structures and functionality presented asseparate components in exemplary configurations may be implemented as acombined structure or component. Similarly, structures and functionalitypresented as a single component may be implemented as separatecomponents. These and other variations, modifications, additions, andimprovements may fall within the scope of the appended claim(s).

Although one or more embodiments of the present invention have beendescribed in some detail for clarity of understanding, it will beapparent that certain changes and modifications may be made within thescope of the claims. Accordingly, the described embodiments are to beconsidered as illustrative and not restrictive, and the scope of theclaims is not to be limited to details given herein, but may be modifiedwithin the scope and equivalents of the claims. In the claims, elementsand/or steps do not imply any particular order of operation, unlessexplicitly stated in the claims.

We claim:
 1. A method of managing direct memory access (DMA) descriptorsfor commands to a non-volatile semiconductor storage device, the methodcomprising: requesting DMA descriptors from the host system for each ofa plurality of the commands stored in a command random access memory(RAM); storing the DMA descriptors for each of the plurality of thecommands in free descriptor regions in a descriptor RAM; and maintaininga dynamic descriptor list in the descriptor RAM for each of theplurality of commands, the dynamic descriptor list for each of theplurality of commands comprising occupied descriptor regions in thedescriptor RAM having associated DMA descriptors.
 2. The method of claim1, wherein each dynamic descriptor list is a linked list having a headdescriptor field and a tail descriptor field, and wherein each of theplurality of commands includes pointers to the head descriptor field andthe tail descriptor field, respectively, in the associated dynamicdescriptor list.
 3. The method of claim 1, wherein the DMA descriptorsfor each of the plurality of commands include data DMA descriptors andmetadata DMA descriptors.
 4. The method of claim 3, wherein each dynamicdescriptor list is a linked list having a head data descriptor field, ahead metadata descriptor field, and a tail descriptor field, and whereineach of the plurality of commands includes pointers to the head datadescriptor field, the head metadata descriptor field, and the taildescriptor field, respectively, in the associated dynamic descriptorlist.
 5. The method of claim 1, wherein each occupied descriptor regionincludes at least one DMA descriptor, at least one type flag indicatinga type of the at least one DMA descriptor, at least one valid flagindicating whether the at least one DMA descriptor is valid, at leastone consumed flag indicating whether the at least one DMA descriptor hasbeen consumed, and pointer to a next occupied descriptor region.
 6. Themethod of claim 5, wherein the pointer to the next occupied descriptorregion in each occupied descriptor region is separately addressable inthe descriptor RAM from the remaining portion of each occupieddescriptor region.
 7. The method of claim 1, wherein the DMA descriptorscomprise descriptors in a scatter-gather list (SGL).
 8. The method ofclaim 1, further comprising: transferring associated DMA descriptors fora command to a back end of the controller; and marking the associatedDMA descriptors for the command as being consumed.
 9. The method ofclaim 8, further comprising: freeing an occupied descriptor region inresponse to all DMA descriptors therein being marked as consumed. 10.The method of claim 8, further comprising: receiving an indication fromthe back end of the controller that the command is complete; and freeingall occupied descriptor regions in the dynamic queue for the command.11. A controller for a non-volatile semiconductor storage device,comprising: a command random access memory (RAM) configured to storecommands received from a host system; a descriptor RAM; and a processingsystem having a back end configured to process active commands and afront end configured to: fetch DMA descriptors from the host system foreach of a plurality of the commands stored in the command RAM; store theDMA descriptors for each of the plurality of the commands in freedescriptor regions in the descriptor RAM; and maintain a dynamicdescriptor list in the descriptor RAM for each of the plurality ofcommands, the dynamic descriptor list for each of the plurality ofcommands comprising occupied descriptor regions in the descriptor RAMhaving associated DMA descriptors.
 12. The controller of claim 11,wherein the front end comprises a data transfer unit configured toreceive the commands from the host system and to request and receive theDMA descriptors from the host system.
 13. The controller of claim 11,wherein the back end includes a DMA transfer controller configured toconsume the DMA descriptors in the descriptor RAM in response toperforming commands in the command RAM.
 14. The controller of claim 11,wherein each dynamic descriptor list is a linked list having a headdescriptor field and a tail descriptor field, and wherein each of theplurality of commands includes pointers to the head descriptor field andthe tail descriptor field, respectively, in the associated dynamicdescriptor list.
 15. The controller of claim 11, wherein the DMAdescriptors for each of the plurality of commands include data DMAdescriptors and metadata DMA descriptors.
 16. The controller of claim15, wherein each dynamic descriptor list is a linked list having a headdata descriptor field, a head metadata descriptor field, and a taildescriptor field, and wherein each of the plurality of commands includespointers to the head data descriptor field, the head metadata descriptorfield, and the tail descriptor field, respectively, in the associateddynamic descriptor list.
 17. The controller of claim 11, wherein eachoccupied descriptor region includes at least one DMA descriptor, atleast one type flag indicating a type of the at least one DMAdescriptor, at least one valid flag indicating whether the at least oneDMA descriptor is valid, at least one consumed flag indicating whetherthe at least one DMA descriptor has been consumed, and pointer to a nextoccupied descriptor region.
 18. The controller of claim 17, wherein thepointer to the next occupied descriptor region in each occupieddescriptor region is separately addressable in the descriptor RAM fromthe remaining portion of each occupied descriptor region.
 19. Thecontroller of claim 11, wherein the DMA descriptors comprise descriptorsof a scatter-gather list (SGL).
 20. A non-transitory computer readablemedium having stored thereon instructions that when executed by aprocessor cause the processor to perform a method of method of managingdirect memory access (DMA) descriptors for commands to a non-volatilesemiconductor storage device, the method comprising: requesting DMAdescriptors from the host system for each of a plurality of the commandsstored in a command random access memory (RAM); storing the DMAdescriptors for each of the plurality of the commands in free descriptorregions in a descriptor RAM; and maintaining a dynamic descriptor listin the descriptor RAM for each of the plurality of commands, the dynamicdescriptor list for each of the plurality of commands comprisingoccupied descriptor regions in the descriptor RAM having associated DMAdescriptors.